﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Workflow2211A.Application.DTO.Inputs.IndependentBilling.ShoppingCart
{
    /// <summary>
    /// 购物车项目DTO
    /// </summary>
    public class ShoppingCartItemDTO
    {
        /// <summary>
        /// 项目类型：1-药品，2-检查，3-检验
        /// </summary>
        [Required(ErrorMessage = "项目类型不能为空")]
        [Range(1, 3, ErrorMessage = "项目类型必须为1-3之间的值")]
        public int ItemType { get; set; }

        /// <summary>
        /// 项目ID
        /// </summary>
        [Required(ErrorMessage = "项目ID不能为空")]
        public long ItemId { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ItemName { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        [Required(ErrorMessage = "数量不能为空")]
        [Range(1, int.MaxValue, ErrorMessage = "数量必须大于0")]
        public int Quantity { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// 总价
        /// </summary>
        public decimal TotalPrice => Price * Quantity;

        /// <summary>
        /// 是否为处方药
        /// </summary>
        public bool IsPrescription { get; set; }

        /// <summary>
        /// 限购数量
        /// </summary>
        public int LimitQuantity { get; set; }
    }
}
